package cowmanager;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.math.BigInteger;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Lauaa
 */
@Entity
@Table(name = "EXPLOTACION", catalog = "", schema = "SYSTEM")
@NamedQueries({
    @NamedQuery(name = "Explotacion.findAll", query = "SELECT e FROM Explotacion e"),
    @NamedQuery(name = "Explotacion.findByPropietario", query = "SELECT e FROM Explotacion e WHERE e.propietario = :propietario"),
    @NamedQuery(name = "Explotacion.findById", query = "SELECT e FROM Explotacion e WHERE e.id = :id"),
    @NamedQuery(name = "Explotacion.findByNumeroreses", query = "SELECT e FROM Explotacion e WHERE e.numeroreses = :numeroreses"),
    @NamedQuery(name = "Explotacion.findByDnicif", query = "SELECT e FROM Explotacion e WHERE e.dnicif = :dnicif")})
public class Explotacion implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    @Basic(optional = false)
    @Column(name = "PROPIETARIO")
    private String propietario;
    @Id
    @Basic(optional = false)
    @Column(name = "ID")
    private String id;
    @Column(name = "NUMERORESES")
    private BigInteger numeroreses;
    @Basic(optional = false)
    @Column(name = "DNICIF")
    private String dnicif;

    public Explotacion() {
    }

    public Explotacion(String id) {
        this.id = id;
    }

    public Explotacion(String id, String propietario, String dnicif) {
        this.id = id;
        this.propietario = propietario;
        this.dnicif = dnicif;
    }

    public String getPropietario() {
        return propietario;
    }

    public void setPropietario(String propietario) {
        String oldPropietario = this.propietario;
        this.propietario = propietario;
        changeSupport.firePropertyChange("propietario", oldPropietario, propietario);
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        String oldId = this.id;
        this.id = id;
        changeSupport.firePropertyChange("id", oldId, id);
    }

    public BigInteger getNumeroreses() {
        return numeroreses;
    }

    public void setNumeroreses(BigInteger numeroreses) {
        BigInteger oldNumeroreses = this.numeroreses;
        this.numeroreses = numeroreses;
        changeSupport.firePropertyChange("numeroreses", oldNumeroreses, numeroreses);
    }

    public String getDnicif() {
        return dnicif;
    }

    public void setDnicif(String dnicif) {
        String oldDnicif = this.dnicif;
        this.dnicif = dnicif;
        changeSupport.firePropertyChange("dnicif", oldDnicif, dnicif);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Explotacion)) {
            return false;
        }
        Explotacion other = (Explotacion) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cowmanager.Explotacion[id=" + id + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
